package com.adcc.loadsheet.billing.controller;

import com.adcc.loadsheet.billing.security.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * controller基础类
 * Created by zhaoml on 2020/4/7.
 */
@Component
public class BasisController {

    @Autowired
    public UserContext userContext;

    public static final Integer PAGE_SIZE_DEFAULT = 10;

    /**
     * 校验查询是否合法
     *
     * @param companyId
     * @param permissionCompanys
     * @throws EFBHUBException
     */
    /*protected void checkFindPermission(Integer companyId) {
        if (companyId == null || permissionCompanys.isEmpty()) {
            throw new EFBHUBException("没有查询权限！", EFBHUBException.PERMISSON_VERIFY_ERROR);
        }
        if (!userContext.getCurrentUser().isSuperAdmin()) {
            boolean flag = false;
            for (CompanyPermissionVO vo : permissionCompanys) {
                if (vo.getId().equals(companyId)) {
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                throw new EFBHUBException("没有查询权限！", EFBHUBException.PERMISSON_VERIFY_ERROR);
            }
        }
    }*/
}